<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/header', TEMPLATE_INCLUDEPATH)) : (include template('common/header', TEMPLATE_INCLUDEPATH));?>
<div class="main">
    <div class="panel panel-default" style="margin-top: 10px;">
        <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner"> 
            <tr>
                <th class="col-md-1 col-gl-1">#</th>
                <th class="col-md-3">场景</th>
                <th class="col-md-2">访问量</th>
                <th class="col-md-1">分享</th>
                <th class="col-md-2">时间</th>
                <th class="col-md-2">状态</th>
                <th class="col-md-2">操作</th>
            </tr>
        </thead>
        <tbody>
    <?php  if(is_array($result['list'])) { foreach($result['list'] as $item) { ?>
            <tr data-info='<?php  echo json_encode($item)?>'>
                <td><?php  echo $item['id'];?></td>
                <td><?php  echo $item['appname'];?></td>
                <td><?php  echo $item['onclick'];?></td>
                <td><?php  echo $item['prize'];?></td>
                <td><?php  echo date('Y-m-d H:i', $item['truetime'])?></td>
                <td><?php  if($app['status']) { ?><span class="label label-success">已上架</span><?php  } else { ?><span class="label label-danger">未上架</span><?php  } ?></td>
                <td><a href="../app/index.php?i=<?php  echo $item['uniacid'];?>&c=entry&appid=<?php  echo $item['id'];?>&m=zht_app&do=preview" target="_blank" class="btn btn-sm btn-info">预览</a></td>
            </tr>
    <?php  } } ?>
        </tbody>
    </table>
        </div>
    </div>
    <?php  echo $result['pager'];?>
</div>

<script type="text/javascript">
    function preview_page(url) {
        require(['jquery', 'util'], function($, u){
            var content = '<iframe width="480" scrolling="yes" height="480" frameborder="0" src="about:blank"></iframe>';
            var footer ='<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>';
            var dialog = u.dialog('预览模板', content, footer);
            dialog.find('iframe').on('load', function(){
                $('a', this.contentWindow.document.body).each(function(){
                    if ($(this).attr('href').substr(0, 4) != 'http') {
                        if ($(this).attr('href').substr(0, 2) == './') {
                            $(this).attr('href', $(this).attr('href') + 's=' + styleid);
                        } else {
                            $(this).attr('href', 'http://' + $(this).attr('href'));
                        }
                    }
                });
            });
            // var url = '../app/./index.php?i=3&c=home&&s=' + styleid + 't=' + multiid;
            dialog.find('iframe').attr('src', url);
            dialog.find('.modal-dialog').css({'width': '322px'});
            dialog.find('.modal-body').css({'padding': '0', 'height': '480px'});
            dialog.modal('show');
        });
    }
    require(['jquery', 'util'], function($, u){
        $('.table button').click(function(){
            var id = $(this).attr('data-id');
            var order_url="<?php  echo url('site/entry', array('do'=>'order','m'=>'mobiorder'))?>&id="+id;
            window.location.href = order_url;
        });
    });

    function preview(_this) {
        require(['jquery', 'util'], function($, u){
            var $this = $(_this).parent().parent();
            var $data = $this.attr('data-info');
            var _obj = JSON.parse($data);
            var content =
    '<table class="table" style="width:100%; min-width:100%">'+
        '<tr><td width="100" class="text-right" style="border-top:0">姓名：</td><td style="border-top:0">'+_obj.truename+'</td></tr>'+
        '<tr><td class="text-right">手机号：</td><td>'+_obj.telstring+'</td></tr>'+
        '<tr><td class="text-right">城市：</td><td>'+_obj.province+'</td></tr>'+
        '<tr><td class="text-right">运营商：</td><td>'+_obj.isp+'</td></tr>'+
        '<tr><td class="text-right">金额：</td><td>'+_obj.price+'</td></tr>'+
        '<tr><td class="text-right">充值时间：</td><td>'+_obj.createtime+'</td></tr>'+
        '<tr><td class="text-right">站内订单号：</td><td>'+_obj.sporder_id+'</td></tr>'+
        '<tr><td class="text-right">欧飞订单号：</td><td>'+_obj.orderid+'</td></tr>'+
        '<tr><td class="text-right">状态：</td><td>'+_obj.errmsg+'</td></tr>'+
    '</table>';
            var footer ='<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>';
            var dialog = u.dialog('详细信息', content, footer);
            dialog.find('.modal-dialog').css({'width': '480px'});
            dialog.modal('show');
        });
    }

</script>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/footer', TEMPLATE_INCLUDEPATH)) : (include template('common/footer', TEMPLATE_INCLUDEPATH));?>